import mongoose from 'mongoose';

const Schema = mongoose.Schema;

// let monitor = {
//   performance: {
//     domComplete: "", // dom 完成时间
//     duration: "", // 整个页面加载完成时间 ?
//     responseEnd: "", // 请求响应结束时间
//   },
//   resources: [],
//   errors: [],
// };
const TraceSchema = new Schema({
  performance: {
    type: Object,
    required: [false, ''],
  },
  resources: {
    type: Array,
    required: [false, ''],
  },
  errors: {
    type: Array,
    required: [true, 'errors field is required'],
  },
});

const Trace = mongoose.model('Trace', TraceSchema);

export default Trace;
